<?xml version="1.0" encoding="utf-8"?>
<openerp>
	<data>

		<record id="view_move_line_form_prioritY_applico" model="ir.ui.view">
			<field name="name">account.move.line.form.priority.applico</field>
			<field name="model">account.move.line</field>
			<field eval="1" name="priority"/>
			<field name="arch" type="xml">
				<form string="Journal Item">
					<sheet>

					</sheet>
				</form>
			</field>
		</record>

<!-- Account Move line -->
		<record id="view_move_line_tree_applico" model="ir.ui.view">
			<field name="name">account.move.line.tree.applico</field>
			<field name="model">account.move.line</field>
			<field name="inherit_id" ref="account.view_move_line_tree"/>
			<field name="arch" type="xml">
				<field name="period_id" position="before">
					<field name="currency"/>
					<field name="amount_original"/>
					<field name="amount_res"/>
				</field>
			</field>
		</record>

<!-- Supplier Payment -->
		<record id="view_vendor_payment_form_applico" model="ir.ui.view">
			<field name="name">account.voucher.payment.form.applico</field>
			<field name="model">account.voucher</field>
			<field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
			<field name="arch" type="xml">
				<button name="action_cancel_draft" position="replace">
					<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="1"/>
				</button>
				<field name="currency_help_label" position="replace">
					<field name="currency_help_label" colspan="2" nolabel="1" invisible="1" class="oe_grey"/>
				</field>
				<field name="payment_rate" position="replace">
					<field name="payment_rate" required="1" invisible="1" class="oe_inline" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
				</field>
				<field name="payment_rate_currency_id" position="replace">
					<field name="payment_rate_currency_id" class="oe_inline" invisible="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
				</field>
				<field name="period_id" position="replace"/>
				<field name="date" position="replace">
					<field name="date" required="1" on_change="onchange_date(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"/>
					<field name="period_id"/>
				</field>
				
				

				<button name="cancel_voucher" string="Cancel Voucher" position="replace">
					<button name="cancel_voucher" string="Cancel Voucher" states="proforma"/>
				</button>
				<field name="partner_id" position="replace">
					<field name="partner_id" required="1" domain="[('supplier','=',True), ('is_company','=',True)]"
						on_change="onchange_journal2(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"
						context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"  string="Supplier"/>
				</field>
				<field name="journal_id" position="replace">
					<field name="journal_id"
						domain="[('type','in',['bank', 'cash'])]"
						widget="selection"
						on_change="onchange_journal2(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"
						string="Payment Method"/>
					<button name="action_compute" string="Compute" type="object" states="draft"/>
				</field>
				<field name="name" position="after">
					<field name="cheque_no" select="1" invisible="context.get('line_type', False)" string="Cheque No" colspan="2"/>
					<field name="bank_draft_no" select="1" invisible="context.get('line_type', False)" string="Bank Draft No" colspan="2"/>
					<field name="ex_rate" groups="base.group_multi_currency"/>
					<field name="change_rate" groups="base.group_multi_currency" on_change="onchange_change_rate(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"/>
					
					
				</field>
				
				<field name="amount" position="replace">
					<field name="amount" class="oe_inline"
						string="Paid Amount"
						widget="monetary" options="{'currency_field': 'currency_id'}"/>
					<field name="bank_charges_amount" class="oe_inline"
						string="Bank Charges Amount"
						widget="monetary" options="{'currency_field': 'currency_id'}"
						/>
					<div class="oe_subtotal_footer_separator oe_inline">
						<label for="grand_total"/>
						<button name="button_dummy"
							states="draft" string="(update)" type="object" class="oe_edit_only oe_link"/>
					</div>
					<field name="grand_total" nolabel="1" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
				</field>

				<field name="payment_option" position="replace">
					<field name="payment_option" required="1"
						on_change="onchange_pay_option(payment_option, type, partner_id)"/>
				</field>
				<field name="writeoff_acc_id" position="replace">
					<field name="writeoff_acc_id"
						attrs="{'invisible':[('payment_option','=','none')], 'required':[('payment_option','!=','none')]}"
						/>
				</field>
				<page string="Payment Information" position="after">
					<page string="Multiple Invoices">
						<group>
							<field name="auto_fill_debit" string ='Auto Fill Debit'/>
						</group>
						<label for="move_line_cr_ids" string="Move Line Debit"/>
						<field name="move_line_cr_ids" attrs="{'readonly':[('state','!=','draft')]}" context="{'multi_partner': partner_id, 'type': type, 'status':'credit'}">
							<tree editable="bottom">
								<field name="move_name" readonly="1"/>
								<field name="invoice" readonly="1"/>
								<field name="currency" readonly="1"/>
								<field name="amount_original"/>
								<field name="amount_res"/>
							</tree>
						</field>
						<group>
							<field name="auto_fill_credit" string ='Auto Fill Credit'/>
						</group>
						<label for="account_move_line_ids" string="Move Line Credit"/>
						<field name="account_move_line_ids" attrs="{'readonly':[('state','!=','draft')]}" context="{'multi_partner': partner_id, 'type': type, 'status':'debit'}">
							<tree editable="bottom">
								<field name="move_name" readonly="1"/>
								<field name="invoice" readonly="1"/>
								<field name="currency" readonly="1"/>
								<field name="amount_original"/>
								<field name="amount_res"/>
							</tree>
						</field>
					</page>
					<page string="Setup">
						<group>
							<button type="action"
	                            name="%(act_change_line_rate)d"
	                            class="oe_stat_button"
	                            icon="fa-sign-in"
	                            string="Change Line Rate" states="draft">
	                        </button>
						</group>
					</page>
				</page>
				<field name="line_dr_ids" position="replace">
					<field name="line_dr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
						<tree string="Supplier Invoices and Outstanding transactions" editable="bottom" colors="gray:amount==0">
							<field name="move_line_id" readonly="1"/>
							<field name="account_id"  readonly="1"/>
							<field name="date_original" readonly="1"/>
							<field name="date_due" readonly="1"/>
							<field name="currency_id" readonly="1"/>
							<field name="amount_original" readonly="1"/>
							<field name="amount_unreconciled" readonly="1"/>
							<field name="reconcile" on_change="onchange_reconcile(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)"/>
							<field name="amount" sum="Total Allocation" on_change="onchange_amount(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)" string="Allocation"/>
							<field name="inv_amount" readonly="1"/>
							<field name="gain_loss_amount" readonly="1"/>
							<field name="balance_amount" readonly="1"/>
							<field name="gain_loss" readonly="1" invisible="1"/>
							<field name="ex_rate" readonly="1"/>
							<field name="change_rate" on_change="onchange_change_rate(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, context)"/>
						</tree>
					</field>
				</field>
				<field name="line_cr_ids" position="replace"/>
				<label for="line_cr_ids" position="replace">
					<label for="line_cr_ids"/>
					<field name="line_cr_ids" ontext="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
						<tree string="Credits" editable="bottom" colors="gray:amount==0">
							<field name="move_line_id" readonly="1"/>
							<field name="account_id"  readonly="1"/>
							<field name="date_original" readonly="1"/>
							<field name="date_due" readonly="1"/>
							<field name="currency_id" readonly="1"/>
							<field name="amount_original" readonly="1"/>
							<field name="amount_unreconciled" readonly="1"/>
							<field name="reconcile" on_change="onchange_reconcile(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)"/>
							<field name="amount" sum="Total Allocation" on_change="onchange_amount(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)" string="Allocation"/>
							<field name="inv_amount" readonly="1"/>
							<field name="gain_loss_amount" readonly="1"/>
							<field name="balance_amount" readonly="1"/>
							<field name="gain_loss" readonly="1" invisible="1"/>
							<field name="ex_rate" readonly="1"/>
							<field name="change_rate" on_change="onchange_change_rate(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, context)"/>
						</tree>
					</field>
				</label>
			</field>
		</record>

<!-- Customer Payment -->

		<record id="view_vendor_receipt_form_applico" model="ir.ui.view">
			<field name="name">account.voucher.receipt.form.applico</field>
			<field name="model">account.voucher</field>
			<field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
			<field name="arch" type="xml">
				<button name="action_cancel_draft" position="replace">
					<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="1"/>
				</button>
				<field name="currency_help_label" position="replace">
					<field name="currency_help_label" colspan="2" nolabel="1" invisible="1" class="oe_grey"/>
				</field>
				<field name="payment_rate" position="replace">
					<field name="payment_rate" required="1" invisible="1" class="oe_inline" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
				</field>
				<field name="payment_rate_currency_id" position="replace">
					<field name="payment_rate_currency_id" class="oe_inline" invisible="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
				</field>
				<field name="period_id" position="replace"/>
				<field name="date" position="replace">
					<field name="date" required="1" on_change="onchange_date(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"/>
					<field name="period_id"/>
				</field>
				<field name="line_dr_ids" position="replace"/>
				<label for="line_dr_ids" position="replace">
					<label for="line_dr_ids"/>
						<field name="line_dr_ids" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
							<tree string="Credits" editable="bottom" colors="gray:amount==0">
								<field name="move_line_id" readonly="1"/>
								<field name="account_id"  readonly="1"/>
								<field name="date_original" readonly="1"/>
								<field name="date_due" readonly="1"/>
								<field name="currency_id" readonly="1"/>
								<field name="amount_original" readonly="1"/>
								<field name="amount_unreconciled" readonly="1"/>
								<field name="reconcile" on_change="onchange_reconcile(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)"/>
								<field name="amount" sum="Total Allocation" on_change="onchange_amount(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)" string="Allocation"/>
								<field name="inv_amount" readonly="1"/>
								<field name="gain_loss_amount" readonly="1"/>
								<field name="balance_amount" readonly="1"/>
								<field name="gain_loss" readonly="1" invisible="1"/>
								<field name="ex_rate" readonly="1"/>
								<field name="change_rate" on_change="onchange_change_rate(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, context)"/>
							</tree>
					</field>
				</label>
				<field name="line_cr_ids" position="replace">
					<field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
						<tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
							<field name="move_line_id" readonly="1"/>
								<field name="account_id"  readonly="1"/>
								<field name="date_original" readonly="1"/>
								<field name="date_due" readonly="1"/>
								<field name="currency_id" readonly="1"/>
								<field name="amount_original" readonly="1"/>
								<field name="amount_unreconciled" readonly="1"/>
								<field name="reconcile" on_change="onchange_reconcile(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)"/>
								<field name="amount" sum="Total Allocation" on_change="onchange_amount(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, amount_unreconciled, context)" string="Allocation"/>
								<field name="inv_amount" readonly="1"/>
								<field name="gain_loss_amount" readonly="1"/>
								<field name="balance_amount" readonly="1"/>
								<field name="gain_loss" readonly="1" invisible="1"/>
								<field name="ex_rate" readonly="1"/>
								<field name="change_rate" on_change="onchange_change_rate(parent.journal_id, parent.date, parent.change_rate, move_line_id, currency_id, change_rate, reconcile, amount, context)"/>
						</tree>
					</field>
				</field>
				<button name="cancel_voucher" string="Cancel Receipt" position="replace">
					<button name="cancel_voucher" string="Cancel Receipt" states="proforma"/>
				</button>
				<field name="partner_id" position="replace">
					<field name="partner_id" string="Customer" domain="[('customer','=',True), ('is_company','=',True)]" required="1"
						on_change="onchange_journal2(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"
						context="{'search_default_customer': 1}"/>
				</field>
				<field name="journal_id" position="replace">
					<field name="journal_id"
						domain="[('type','in',['bank', 'cash'])]"
						widget="selection"
						on_change="onchange_journal2(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"
						string="Payment Method"/>
					<button name="action_compute" string="Compute" type="object" states="draft"/>
				</field>
				
				<field name="name" position="after">
					<field name="cheque_no" select="1" invisible="context.get('line_type', False)" string="Cheque No" colspan="2"/>
					<field name="bank_draft_no" select="1" invisible="context.get('line_type', False)" string="Bank Draft No" colspan="2"/>
					<field name="ex_rate" groups="base.group_multi_currency"/>
					<field name="change_rate" groups="base.group_multi_currency" on_change="onchange_change_rate(partner_id, journal_id, type, currency_id, line_dr_ids, line_cr_ids, context)"/>
				</field>
				
				<field name="amount" position="replace">
					<field name="amount" class="oe_inline"
								string="Paid Amount"
								widget="monetary" options="{'currency_field': 'currency_id'}"/>
					<field name="bank_charges_amount" class="oe_inline"
						string="Bank Charges Amount"
						widget="monetary" options="{'currency_field': 'currency_id'}"
						/>
					<div class="oe_subtotal_footer_separator oe_inline">
						<label for="grand_total"/>
						<button name="button_dummy"
							states="draft" string="(update)" type="object" class="oe_edit_only oe_link"/>
					</div>
					<field name="grand_total" nolabel="1" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
				</field>
				<field name="payment_option" position="replace">
					<field name="payment_option" required="1"
						on_change="onchange_pay_option(payment_option, type, partner_id)"/>
				</field>
				<field name="writeoff_acc_id" position="replace">
					<field name="writeoff_acc_id"
						attrs="{'invisible':[('payment_option','=','none')], 'required':[('payment_option','!=','none')]}"
						/>
				</field>
				<page string="Payment Information" position="after">
					<page string="Multiple Invoices">
						<group>
							<field name="auto_fill_credit" string ='Auto Fill Debit'/>
						</group>
						<label for="account_move_line_ids"/>
						<field name="account_move_line_ids" attrs="{'readonly':[('state','!=','draft')]}" context="{'multi_partner': partner_id, 'type': type, 'status':'debit'}">
							<tree editable="bottom">
								<field name="move_name" readonly="1"/>
								<field name="invoice" readonly="1"/>
								<field name="currency" readonly="1"/>
								<field name="amount_original"/>
								<field name="amount_res"/>
							</tree>
						</field>
						<group>
							<field name="auto_fill_debit" string ='Auto Fill Credit'/>
						</group>
						<label for="move_line_cr_ids"/>
						<field name="move_line_cr_ids" attrs="{'readonly':[('state','!=','draft')]}" context="{'multi_partner': partner_id, 'type': type, 'status':'credit'}">
							<tree editable="bottom">
								<field name="move_name" readonly="1"/>
								<field name="invoice" readonly="1"/>
								<field name="currency" readonly="1"/>
								<field name="amount_original"/>
								<field name="amount_res"/>
							</tree>
						</field>
					</page>
					<page string="Setup">
						<group>
							<button type="action"
	                            name="%(act_change_line_rate)d"
	                            class="oe_stat_button"
	                            icon="fa-sign-in"
	                            string="Change Line Rate" states="draft">
	                        </button>
						</group>
					</page>
				</page>
			</field>
		</record>

		<record id="account_voucher.menu_action_sale_receipt" model="ir.ui.menu">
			<field name="groups_id" eval="[(6,0,[ref('hidden_applico')])]"/>
		</record>

		<record id="account_voucher.menu_action_purchase_receipt" model="ir.ui.menu">
			<field name="groups_id" eval="[(6,0,[ref('hidden_applico')])]"/>
		</record>

		<record id="account_voucher.menu_encode_entries_by_voucher" model="ir.ui.menu">
			<field name="groups_id" eval="[(6,0,[ref('hidden_applico')])]"/>
		</record>

	</data>
</openerp>
